import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

const store = new Vuex.Store({
    state: {
        // token: getToken(),
        username: '',
        password: '',
        roles: '',
        routerMap: [
            [
                {
                    path: '/userCharge',
                    component: Layout,
                    children: [
                        {
                            path: 'userCharge',
                            name: 'userCharge',
                            meta: { title: '（a）用户管理', icon: 'example', roles: 1 },
                            component: () => import('@/views/userCharge/userCharge')
                        }
                    ]
                },

                {
                    path: '/workDay',
                    component: Layout,
                    children: [
                        {
                            path: 'workDay',
                            name: 'workDay',
                            component: () => import('@/views/workDay/workDay'),
                            meta: { title: '（a）工作日管理', icon: 'form', roles: 1 }
                        }
                    ]
                },
                {
                    path: '/roleCharge',
                    component: Layout,
                    children: [
                        {
                            path: 'roleCharge',
                            name: 'roleCharge',
                            component: () => import('@/views/roleCharge/roleCharge'),
                            meta: { title: '（a）角色管理', icon: 'example', roles: 1 }
                        }
                    ]
                },
                { path: '*', redirect: '/404', hidden: true }
            ], [
                {
                    path: '/unusualAttendance',
                    component: Layout,
                    children: [
                        {
                            path: 'unusualAttendance',
                            name: 'unusualAttendance',
                            component: () => import('@/views/unusualAttendance/unusualAttendance'),
                            meta: { title: '(上领)异常考勤处理', icon: 'table', roles: 2 }
                        }
                    ]
                },
                {
                    path: '/attendanceRecord',
                    component: Layout,
                    children: [
                        {
                            path: 'attendanceRecord',
                            name: 'attendanceRecord',
                            component: () => import('@/views/attendanceRecord/attendanceRecord'),
                            meta: { title: '(上领)请假审批', icon: 'form', roles: 2 }
                        }
                    ]
                },
                { path: '*', redirect: '/404', hidden: true }
            ], [
                {
                    path: '/dayOff',
                    component: Layout,
                    children: [
                        {
                            path: 'dayOffCheck',
                            name: 'dayOffCheck',
                            component: () => import('@/views/dayOff/dayOffCheck'),
                            meta: { title: '(领)员工考勤', icon: 'form', roles: 2 }
                        }
                    ]
                },
                { path: '*', redirect: '/404', hidden: true }
            ], [
                {
                    path: '/dayOff',
                    component: Layout,
                    children: [
                        {
                            path: 'dayOffApplication',
                            name: 'dayOffApplication',
                            component: () => import('@/views/dayOff/dayOffApplication'),
                            meta: { title: '(员工)请假申请', icon: 'form', roles: 3 }
                        }
                    ]
                },
                {
                    path: '/attendanceMaintenance',
                    component: Layout,
                    children: [
                        {
                            path: 'attendanceMaintenance',
                            name: 'attendanceMaintenance',
                            component: () => import('@/views/attendanceMaintenance/attendanceMaintenance'),
                            meta: { title: '考勤异常维护', icon: 'form', roles: 3 }
                        }
                    ]
                },
                {
                    path: '/test',
                    component: Layout,
                    children: [
                        {
                            path: 'test1',
                            name: 'test1',
                            component: () => import('@/views/test/test1'),
                            meta: { title: '(员工)签到管理', icon: 'form', roles: 3 }
                        }
                    ]
                },
                { path: '*', redirect: '/404', hidden: true }
            ]
        ]

    },
    mutations: {
        SET_NAME: (state, name) => {
            state.name = name
        },
        SET_PASSWORD: (state, password) => {
            state.password = password
        },
        SET_ROLES: (state, roles) => {
            state.roles = roles
        }
    },
    getters: {

    },
    actions: {

    }
})

// export default store

